package com.cloudwise.util;

import com.cloudwise.entity.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2021/12/8 11:08
 * @description：我的工具类
 * @modified By：
 * @version: 1.0
 */
public class MyUtil {
    /**
     * @create by: Teacher陈（86521760@qq.com）
     * @description: 获取当前登录的用户
     * @create time: 2021/12/8 11:10
     * @param
     * @return com.cloudwise.entity.User
     */
    public static User getCurrentUser(){
        Subject subject = SecurityUtils.getSubject();
        Object principal = subject.getPrincipal();
        return (User) principal;
    }
}
